package com.ncmmall.application.business.goods;

import com.ncmmall.domain.business.goods.collect.GoodsCollect;
import com.ncmmall.domain.business.goods.collect.GoodsCollectRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.sql.Timestamp;

/**
 * 商品收藏
 *
 * @author likaikai
 * @date 2019-07-15 11:17
 */
@Service
@Transactional
public class GoodsCollectApplication {

    @Autowired
    private GoodsCollectRepository repository;

    /**
     * 添加收藏
     *
     * @param goodsCollect
     */
    public void create(GoodsCollect goodsCollect) {
        goodsCollect.setCreateTime(new Timestamp(System.currentTimeMillis()));
        repository.save(goodsCollect);
    }

    /**
     * 取消收藏
     *
     * @param goodsCollect
     */
    public void remove(GoodsCollect goodsCollect) {
        repository.delete(goodsCollect);
    }

}
